<%@page import="java.text.SimpleDateFormat" %>
<%@page import="JurisPro.modelo.Evento" %>
<%@page import="JurisPro.modelo.Historico" %>

<jsp:include page="static/cabecalhoAdm.jsp"/>
  <tr align="center" valign="top" bgcolor="#E5E5E5">
   <td height="32" colspan="7"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
       <td class="arvore"><a href="/JurisPro/go_to?pagina=inicio_adm">In&iacute;cio</a> --&gt; <a href="/JurisPro/go_to?pagina=processos_adm">Processos</a> --&gt; Detalhar</td>
     </tr>
   </table>
     <table width="776" border="0" align="center" cellpadding="0" cellspacing="0">     
     	<tr>
       		<td width="620" height="39" bgcolor="#7C7E79" class="topicos">Detalhes do Processo<br /></td>
     	</tr>   
     </table>
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr>
         <td>
     <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
       <tr>
         <td>&nbsp;</td>
       </tr>
     </table>
     <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
           <td width="10"><img src="images/j_arrow_down.gif" width="10" height="10" /></td>
           <td class="texto">&nbsp;Informa&ccedil;&otilde;es do Processo</td>
        </tr>
     </table>

           <jsp:useBean id="prodetalhe" type="JurisPro.modelo.Processo" scope="request" />
           <jsp:useBean id="user" type="JurisPro.modelo.Usuario" scope="session" />
           
           <table width="90%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" class="tabela">
             <tr class="sub">
               <td width="126" height="30">N&ordm; do Processo</td>
               <td width="71">Pasta</td>
               <td width="212">Autor</td>
               <td width="213" height="30">Parte</td>
               <td width="146" height="30">Data de Entrada</td>
             </tr>
             <tr bordercolor="#666666" class="texto">
               
               <td height="36"><%= prodetalhe.getNumProcesso()%></td>              
               <td><%= prodetalhe.getPasta()%></td>              
               <% if(prodetalhe.getCliente()){    %>
        		 <td><%= prodetalhe.getAutor()%> (Cliente)</td>
        		 <td><%= prodetalhe.getParte()%></td>
        		 <% }else {    %>
        		 <td><%= prodetalhe.getAutor()%></td>
        		 <td><%= prodetalhe.getParte()%> (Cliente)</td>
        		 <% } 
            	   	SimpleDateFormat formate = new SimpleDateFormat("dd/MM/yyyy");
        		 %>

               <td><%= formate.format(prodetalhe.getDataEntrada())%></td>
             </tr>
           </table>
           <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
             <tr>
             <%if (prodetalhe.getResponsavel() == user.getId()){ %>
               <td width="513" class="novo">Editar&nbsp;</td>
               <td width="42"><a href="/JurisPro/do_it?comando=editar&num=<%=prodetalhe.getNumProcesso()%>"><img src="images/page_edit.gif" width="42" height="42" border="0" /></a></td>
               <td width="98" class="novo">Visualizar &nbsp;</td>
               <td width="42"><a href="/JurisPro/pdf?num=<%=prodetalhe.getNumProcesso()%>" target="_blank"><img src="images/ico-pdf.jpg" width="42" height="49" border="0" /></a></td>
               <%} else{%>
               <td width="653" class="novo" colspan="2">Visualizar &nbsp;</td>
               <td width="42" colspan="2"><a href="/JurisPro/pdf?num=<%=prodetalhe.getNumProcesso()%>">
               		<img src="images/ico-pdf.jpg" width="42" height="49" border="0" /></a>
               </td>               
               <%}%>               
             </tr>
           </table>
           <p>&nbsp;</p>
         
    <table width="776" border="0" align="center" cellpadding="0" cellspacing="0">     
     	<tr>
       		<td width="620" height="39" bgcolor="#7C7E79" class="topicos">Eventos do Processo<br /></td>
     	</tr>   
     </table>
     <tr>
         <td>

     <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
         <td>&nbsp;</td>
       </tr>
        <tr>
           <td width="10"><img src="images/j_arrow_down.gif" width="10" height="10" /></td>
           <td class="texto">&nbsp;Eventos</td>
        </tr>
     </table>   
     <jsp:useBean id="eventospro" type="java.util.List<JurisPro.modelo.Evento>" scope="request" />
     <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" class="tabela">
       <tr class="sub">
         <td width="65" height="30" align="center">Data</td>
         <td width="59">Hora</td>
         <td width="179">Descri&ccedil;&atilde;o</td>
         <td width="141">Local/Foro</td>
         <td width="177">Resultado</td>
        </tr>
     <% String c1 = "#E5E5E5";
        String c2 = "#f3f3f3";
        int c3 = 1;
        SimpleDateFormat fmt = new SimpleDateFormat("dd/MM/yyyy");
       for(Evento evento : eventospro){
    	  
    	   %>  
    	 <tr bgcolor="<% if(c3 == 1) { c3 = 2; out.print(c1); }
    	 else { c3 = 1; out.print(c2); } %>" class="texto">
 	 
         <td height="26"><%= fmt.format(evento.getData())%></td>
           <% int h = evento.getData().getHours();
		   int m = evento.getData().getMinutes();
		   String hora = ""+h;		if (h < 10) hora = "0"+h;
		   String minuto = ""+m;	if (m < 10) minuto = "0"+m;	%> 
         
         <td><%= hora %>:<%= minuto %></td>
         <td><%= evento.getDescricao()%></td>
         <td><%= evento.getLocal()%></td>
         <td><%= evento.getResultado()%></td>
	   </tr>      	   
      <% }       %>
     </table>     
     <p>&nbsp;</p>
     
     
     <table width="776" border="0" align="center" cellpadding="0" cellspacing="0">     
     	<tr>
       		<td width="620" height="39" bgcolor="#7C7E79" class="topicos">Hist&oacute;rico do Processo<br /></td>
     	</tr>   
     </table>
     <tr>
         <td>
     <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
       <tr>
         <td>&nbsp;</td>
       </tr>
     </table>
     <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
           <td width="10"><img src="images/j_arrow_down.gif" width="10" height="10" /></td>
           <td class="texto">&nbsp;Movimenta&ccedil;&atilde;o</td>
        </tr>
     </table>   
     <jsp:useBean id="historicos" type="java.util.List<JurisPro.modelo.Historico>" scope="request" />
     <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" class="tabela">
       <tr class="sub">
         <td width="168" height="30" align="center">N&ordm; do Processo</td>
         <td width="200">Remetente</td>
         <td width="100">Data Envio</td>
         <td width="200">Destinat&aacute;rio</td>
         <td width="100">Data Recebimento</td>
        </tr>
     <%for(Historico historico : historicos){%>  
    	 <tr bgcolor="<% if(c3 == 1) { c3 = 2; out.print(c1); }
    	 else { c3 = 1; out.print(c2); } %>" class="texto"> 	 
         <td><%=historico.getNumProcesso()%></td>        
         <td><%=historico.getnomeRemetente()%></td>         
         <td><%= fmt.format(historico.getDataEnvio())%></td>
         <td><%=historico.getnomeDestinatario()%></td>
         <%if(historico.getIdDestinatario() == 1){ %>
         		<td><%= fmt.format(historico.getDataEnvio())%>  Encerrado</td>
         <%}else{%>
         <%if(historico.getSituacao()==0){ %>
        	 <td>Em espera</td>
         <%} %>
         <%if(historico.getSituacao()==1){ %>
         <td><%= fmt.format(historico.getDataResposta())%></td>
         <%}%>
         <%if(historico.getSituacao()==2){ %>
         <td><%= fmt.format(historico.getDataResposta())%>  Recusado</td>
         <%}}%>
         
         <%}%>
         
	   </tr>      	   
      
     </table>     
     <p>&nbsp;</p>
          
     </td>
  </tr> 
</table>
<jsp:include page="static/rodape.jsp"/>






 